<?php
//php artisan make:seeder ArticleAndAuthorTableSeeder
use Illuminate\Database\Seeder;
//php artisan db:seed --class=ArticleAndAuthorTableSeeder 执行文件
class ArticleAndAuthorTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //文章表
        DB::table('article')->insert([
            [
                'article_name'  => '你好啊',
                'author_id'  => rand(1, 3)
            ],
            [
                'article_name'  => '一个人',
                'author_id'  => rand(1, 3)
            ],
            [
                'article_name'  => '八十五',
                'author_id'  => rand(1, 3)
            ],
        ]);
        //作者表
        DB::table('author')->insert([
            [
                'author_name'  => '人民网',
            ],
            [
                'author_name'  => '腾讯网',
            ],
            [
                'author_name'  => '网易',
            ],
        ]);
    }
}
